<?php

       $id = !empty($_GET['id'])?$_GET['id']:'';

       if(!empty($_POST)){
             $name=$_POST['name'];
             $pid=$_POST['pid'];

        $sql = "update `cate` set `name` = '$name',`pid`='$pid' where `id`='$id'";

        mysqli_query($link,$sql);

         $_rows=mysqli_affected_rows($link);

         if($_rows>0){
          echo '<script> alert ("类型编辑成功");location.href="index.php?c=cate&a=list&admin=1";</script>';die;
       
          }else{

          echo '<script> alert ("类型编辑失败");history.go(-1);</script>';
        die;
          }



         }




       $sql = "select * from `cate` where `id`=$id";

       $result = mysqli_query($GLOBALS['link'],$sql);

      // 查询到的结果存储
       $data = mysqli_fetch_assoc($result);
       $cate = editCate($data);
       
//链接语句
include (VIEW_PATH.$admin.'layout.html');

?>

